/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package hitunggaji;

import java.util.ArrayList;
import java.util.List;
import javax.swing.table.AbstractTableModel;
import Karyawan.Karyawan;


/**
 *
 * @author yolan
 */
public class gajitabelmodel extends AbstractTableModel {

   
     private ArrayList<Gaji> k = new ArrayList<Gaji>();

    public gajitabelmodel(List<Gaji> k) {
        this.k = (ArrayList<Gaji>) k;
    }

    @Override
    public int getRowCount() {
        return k.size();
    }

    @Override
    public int getColumnCount() {
        return 5;
    }

    @Override
    public Object getValueAt(int rowIndex, int columnIndex) {
        Gaji kategori = k.get(rowIndex);
        switch (columnIndex) {
            case 0:
                return kategori.getGajigolongan();
            case 1:
                return kategori.getPinjaman().getPinjaman();
            case 2:
                return kategori.getTotalgaji();
            case 3:
                return kategori.getNip().getNIP();
                case 4:
                return kategori.getTanggal();
            default:
                return " ";
        }
    }

    @Override
    public String getColumnName(int column) {
        switch (column) {
            case 0:
                return "gaji murni ";
            case 1:
                return "pinjaman ";
            case 2:
                return "total gaji ";
            case 3:
                return "NIP";
                case 4:
                return "Tanggal";
            default:

                return " ";
        }
    }
}
